﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HRLib;



namespace HrConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ResetDb();
            Test();
        }

        public static void Test()
        {
            EntityFactory.Instance.Context = new HrContext();
            using (EntityFactory.Instance.Context)
            {
                foreach (Employee e in EntityFactory.Instance.GetEmployeesMakingMoreThan(101))
                    Console.WriteLine(e.Name);
            }
        }

        public static void ResetDb()
        {
            using (HrContext ctx = new HrContext())
            {
                ctx.Database.Delete();

                Company comp = new Company("Strickland Propane", "11-1112233");
                comp.Hire(new Employee("Hank Hill", "123-45-6789", 100));
                comp.Hire(new Employee("Peggy Hill", "123-45-6788", 300));
                comp.Hire(new Employee("Bobby Hill", "123-45-6787", 200));
                comp.Hire(new Employee("Luanne Platter", "123-45-6786", 200));
                comp.Hire(new Employee("Bill Deautrieve", "123-45-6785", 200));
                comp.Hire(new Employee("Bud Weiser", "123-45-6784", 400));

                Company c2 = new Company("Gribble Extermination", "00-1234567");
                c2.Hire(new Employee("Dale Gribble", "000-00-0000"));
                c2.Hire(new Employee("Nancy Gribble", "999-99-9999"));

                ctx.Companies.Add(comp);
                ctx.Companies.Add(c2);
                ctx.SaveChanges();
               
            }
        }
    }
}
